using System;
using System.Xml;
using System.Xml.Serialization;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using System.IO;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Web;
using System.Web.Configuration;

namespace Akabana.Amf.Messaging.Gateway.Configuration
{

	internal sealed class MessagingGatewayConfiguration
    {
        private const string SECTION_NAME = "akabana.amf.messaging.gateway";

        public static MessagingGatewaySettings Settings;

        private static object _lockObject = new object();

		private MessagingGatewayConfiguration()
		{
		}

        public static void Configure()
		{
			lock (_lockObject) 
			{
                if (Settings == null)
				{
                    var settings_ = (MessagingGatewaySettings)ConfigurationManager.GetSection(SECTION_NAME);
                    if (settings_ == null)
                    {
                        settings_ = new MessagingGatewaySettings();
                    }
                    
                    System.Threading.Thread.MemoryBarrier();

                    Settings = settings_;
    			}
			}
		}
        
	}
}
